{% extends 'email_base.html' %}

{% load i18n seahub_tags %}

{% block email_con %}

<p style="font-size:14px; line-height: 1.5; color:#121214; margin:.2em 0 12px;">{% blocktrans with name=to_user|email2nickname %}Hi, {{ name }}{% endblocktrans %}</p>
<p style="font-size:14px; line-height: 1.5; color:#434144; margin:.2em 0;">
{% blocktrans count num=notice_count %}
You've got 1 new notice on {{ site_name }}:
{% plural %}
You've got {{num}} new notices on {{ site_name }}:
{% endblocktrans %}
</p>

    <table style="width:100%; margin:12px 0 20px; table-layout:fixed; border-spacing: 0; border-collapse: collapse;">
        <tr>
            <th width="9%" style="padding: 5px 3px; border-bottom: 1px solid #eee;"></th>
            <th width="69%" style="padding: 5px 3px; border-bottom: 1px solid #eee; font-size:13px; text-align: left; font-weight: normal; color: #9c9c9c;">{% trans "Message" %}</th>
            <th width="22%" style="padding: 5px 3px; border-bottom: 1px solid #eee; font-size:13px; text-align: left; font-weight: normal; color: #9c9c9c;">{% trans "Time" %}</th>
        </tr>
        {% for notice in notices %}
        <tr>
            <td style="padding:8px 3px 5px; border-bottom: 1px solid #eee; text-align:center; vertical-align:top;"><img src="{{notice.avatar_src}}" width="32" height="32" alt="" style="border-radius:1000px;" /></td>
            <td style="padding: 5px 3px; border-bottom: 1px solid #eee; font-size: 13px; color: #333; word-wrap: break-word;">
                {% if notice.is_group_msg %}
                    <p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with user=notice.notice_from grp_url=notice.group_url grp_name=notice.group_name%}{{user}} posted a new discussion in <a href="{{url_base}}{{grp_url}}">{{grp_name}}</a>{% endblocktrans %}</p>
                    {% if notice.grp_msg %}
                    <p style="line-height:1.5; margin:.2em 10px .2em 0;">{{notice.grp_msg}}</p>
                    {% endif %}

                {% elif notice.is_grpmsg_reply %}
                    <p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with user=notice.notice_from reply_url=notice.group_msg_reply_url%}{{user}} replied your <a href="{{url_base}}{{reply_url}}">group discussion</a>{% endblocktrans %}</p>
                    {% if notice.grp_reply_msg %}
                    <div style="margin-right: 10px;">
                        {% if notice.grpmsg_topic %}
                        <p style="padding: 4px 13px; border-left: 3px solid #e0e0e0; line-height:1.5; margin:.2em 0 .2em 7px;">{{notice.grpmsg_topic|truncatechars:45}}</p>
                        {% endif %}
                        <p style="line-height:1.5; margin:.2em 0;">{{notice.grp_reply_msg}}</p>
                    </div>
                    {% endif %}

                {% elif notice.is_repo_share_msg %}
                    <p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with user=notice.notice_from lib_url=notice.repo_url lib_name=notice.repo_name%}{{user}} has shared a library named <a href="{{url_base}}{{lib_url}}">{{lib_name}}</a> to you.{% endblocktrans %}</p>

                {% elif notice.is_priv_file_share_msg %}
                    <p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with user=notice.notice_from file_url=notice.priv_shared_file_url file_name=notice.priv_shared_file_name %}{{user}} has shared a file named <a href="{{url_base}}{{file_url}}">{{file_name}}</a> to you.{% endblocktrans %}</p>

                {% elif notice.is_user_message %}
                    <p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with msg_url=notice.user_msg_url user=notice.notice_from %}You have received a <a href="{{ url_base }}{{msg_url}}">new message</a> from {{user}}.{% endblocktrans %}</p>
                    {% if notice.user_msg %}
                    <p style="line-height:1.5; margin:.2em 10px .2em 0;">{{notice.user_msg}}</p>
                    {% endif %}

                {% elif notice.is_file_uploaded_msg %}
                    <p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with file_url=notice.file_link file_name=notice.file_name folder_url=notice.folder_link folder_name=notice.folder_name %}A file named <a href="{{url_base}}{{file_url}}">{{file_name}}</a> is uploaded to your folder <a href="{{url_base}}{{folder_url}}">{{folder_name}}</a>.{% endblocktrans %}</p>

                {% elif notice.is_group_join_request %}
                <p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with user_url=notice.grpjoin_user_profile_url user=notice.notice_from grp_url=notice.grpjoin_group_url grp_name=notice.grpjoin_group_name msg=notice.grpjoin_request_msg %}User <a href="{{url_base}}{{user_url}}">{{user}}</a> has asked to join group <a href="{{url_base}}{{grp_url}}">{{grp_name}}</a>, verification message: {{msg}}{% endblocktrans %}</p>
              {% endif %}
            </td>
            <td style="padding: 5px 3px; border-bottom: 1px solid #eee; font-size: 13px; color: #333; word-wrap: break-word;">{{ notice.timestamp|date:"Y-m-d G:i:s"}}</td>
        </tr>
        {% endfor %}
    </table>

<p style="font-size:14px;color:#434144;">
{% trans "Go check out at the following page:" %}<br />
{{ url_base }}{% url 'user_notification_list' %}
</p>
{% endblock %}
